#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
ll a[N], n, c;

bool check(int x) {
	int now = a[1];
	ll cnt = 1;
	for (int i = 2; i <= n; i++) {
		if (a[i] - now >= x) {
			cnt++;
			now = a[i];
		}
		if (cnt == c) return true;
	}
	return false;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> c;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	int l = 0, r = 1e9;
	while (l + 1 < r) {
		int mid = (l + r) >> 1;
		if (check(mid)) l = mid;
		else r = mid;
	}
	cout << l << '\n';
	return 0;
}